<{:W('Bizhome/header',array($biz_item_num,$user))}>
    <div class="right_box">
		<div class="content">
			<div class="head_box">
				<h2>公告列表</h2>
				<form id="myForm" action="__APP__/Home/Announce/changeType" method="post">
				<select name="announce_select" id="announce_select" onchange="formSubmit()">
				   <option value="0" >请选择</option>
				   <option value="1" <range name="user.access" value="1,4,5,7" type="notin" >disabled</range> >球馆公告</option>
				   <option value="2" <range name="user.access" value="3,5,6,7" type="notin" >disabled</range> >教练公告</option>
                   <option value="3" <range name="user.access" value="2,4,6,7" type="notin" >disabled</range> >球会公告</option>
				</select>
				</form>
			</div>
			
			<div class="info_table">
				<table>
					<tbody>
						<tr>
							<th>公告名称</th>
							<th>公告发布时间</th>
							<th>公告性质</th>
							<th>功能</th>
						</tr>
					<foreach name="data" item="vo" key="k" >
						<!-- <input type="hidden" name="gymnasium_id" value="<{$vo.gymnasium_id}>" /> -->
                        <tr class="alt">
                         	<td><{$vo.announce_title}><input type="hidden" class="announce_id" value="<{$vo.announce_id}>"></input></td>
                         	<td class="detail">
                         		<{$vo.announce_time}>
                         	</td>
							<td>
							    <in name="vo.announce_type" value = "0">系统公告</in>
								<in name="vo.announce_type" value = "1">球馆公告</in>
                         		<in name="vo.announce_type" value = "2">教练公告</in>
                                <in name="vo.announce_type" value = "3">球会公告</in><br>
								<in name="vo.if_public" value = "0">不公开</in>
								<in name="vo.if_public" value = "1">公开</in>
							    
							</td>
                         	<td>
                         		<button onclick="announce_detail(<{$k}>)">详情</button>
								<button onclick="delete_announce(<{$k}>)">删除</button>
                         		<button onclick="edit_announce(<{$k}>)">修改</button>
							
                         	</td>
                        </tr> 
                    </foreach>					              
					</tbody>
				</table>
				
			</div>	
			
			<div class="blank"></div>		
		</div>
	</div>	
 <script>
   
   var select = document.getElementById("announce_select");
   var announce_id_set=document.getElementsByClassName("announce_id");
   var access;
   function formSubmit()
   {
	 document.getElementById("myForm").submit();
   }
   function announce_detail(num)
   {
      selected=announce_id_set[num].value;
	   layer.open({
                 type: 2,
                 title: '公告详情',
                 maxmin: true,
                 shadeClose: true, //点击遮罩关闭层
                 area : ['600px' , '420px'],
                 content: 'announce_detail.html'
				 });
   }
   function delete_announce(num)
   {
	 selected=announce_id_set[num].value;
	  layer.confirm('确定删除？', {
       btn: ['确定','取消'] //按钮
       }, function(){      
       $.post('__URL__/deleteAnnounce',{'announce_id':selected},function(resultList){ 			   
			  msg=resultList.msg;
			  if (msg!=0) {
			    layer.msg('删除失败');
			  }
			  else 
			  {
			    layer.msg('删除成功');
			  }
    	     },'json');  
    }, function(){
      
    });
   }
   
   function edit_announce(num)
   {
      access=<{$user.access}>;
	  selected=announce_id_set[num].value;
	  layer.open({
                 type: 2,
                 title: '修改公告',
                 maxmin: true,
                 shadeClose: true, //点击遮罩关闭层
                 area : ['600px' , '420px'],
                 content: 'edit_announce.html'
				 });
   }
   </script>

<div class="blank20"></div>
<{:W('Bizhome/footer')}>
